/**
 * @file fork.c
 * @author lyke (1556553295@qq.com)
 * @brief fork 系统调用
 * @version 0.1
 * @date 2023-02-02
 *
 * @copyright Copyright (c) 2023
 *
 */

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char const *argv[]) {
  pid_t pid;

  pid = fork();
  if (pid > 0) {
    printf("parent process.\n");
  } else if (!pid) {
    printf("child process.\n");
  } else if (pid == -1) {
    perror("fork");
  }

  return 0;
}
